<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML" 4.01"//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- Created: August 21, 2001-->
<!--
$Id: RepUnresRec.php,v 1.5 2001/11/02 19:10:03 eugenem Exp $
$Header: /export/home/eugenem/public_html/ComplianceReports/RCS/RepUnresRec.php,v 1.5 2001/11/02 19:10:03 eugenem Exp $
$Log: RepUnresRec.php,v $
Revision 1.5  2001/11/02 19:10:03  eugenem
Moved HTTP_*_VARS processing to dbc.inc

Revision 1.4  2001/11/02 15:00:18  eugenem
Moved database connect statements to a separate file.

Revision 1.3  2001/09/05 19:56:31  eugenem
Changed table structure for Recommendations table.

Revision 1.2  2001/08/21 19:13:35  eugenem
Fixed date criteria for SELECT statement.  Originally it was selecting surveys less than 1 month old.  Now select surveys older than one month back to the start of the current year.

Revision 1.1  2001/08/21 19:09:02  eugenem
Initial revision

-->

<html>
<head>
<title>Radiological Equipment Database</title>
<meta name="author" content="Eugene Mah">
<link rev="made" href="mailto:eugenem@ix.netcom.com">
<link rev="home" href="http://home.netcom.com/~eugenem/">
<meta name="description" content="">
<meta name="Keywords" content="">
<meta name="Reply-to" content="eugenem@ix.netcom.com">
<META http-equiv="PICS-Label" content='(PICS-1.1 "http://www.classify.org/safesurf/" l r (SS~~0001))'>
<?PHP
require('functions.inc');
require('dbc.inc');

$today = date("Ymd");
$year = date("Y");
$month = date("m");
$day = date("d");
?>
</head>

<body>
<h1>Radiological Equipment Database</h1>
<h2>List Unresolved Survey Recommendations older than 30 days</h2>
<form>
<?PHP
$query = "SELECT Description,TestDate,TestDates.SurveyID,Machines.MachineID,Recommendation,Resolved 
          FROM Machines,TestDates,Recommendations 
		  WHERE Machines.MachineID=TestDates.MachineID 
		  AND TestDates.SurveyID=Recommendations.SurveyID 
		  AND Recommendations.Resolved=0 
		  AND (TestDate < " . date("Ymd",mktime(0,0,0,$month-1,$day,$year)) . "
		  AND TestDate > " . date("Ymd",mktime(0,0,0,1,1,$year)) . "
		  ) ORDER BY TestDate,Description";

$result = mysql_query($query)
  or die ("<p>Unable to execute query: $query\n</p>");
?>

<table border=1>
  <tr>
    <th>SurveyID</th><th>Survey Date</th><th>Description</th><th>Recommendation</th>
  </tr>

  <?PHP
while ($row = mysql_fetch_array($result)) {
  echo "<tr>\n";
  echo "<td>" . $row['SurveyID'] . "</td>\n";
  echo "<td>" . $row['TestDate'] . "</td>\n";
  echo "<td>" . $row['Description'] . "</td>\n";
  echo "<td>" . $row['Recommendation'] . "</td>\n";
  echo "</tr>\n";
}
?>
</table>
</form>
<p><a href="index.html" target="_top" >Main menu</a></p>
</body>
</html>
